package com.example.pceb.controller;

import com.example.pceb.VO.ApplyInformationVO;
import com.example.pceb.entity.ApplyInformation;
import com.example.pceb.entity.Project;
import com.example.pceb.result.Result;
import com.example.pceb.service.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/projects")
public class ProjectController {
    @Autowired
    private ProjectService projectService;
    @PostMapping("send")
    public Result<String> sendProjects(@RequestBody ApplyInformationVO applyInformationVO) {
        return projectService.addProject(applyInformationVO.getApplyInformation(),applyInformationVO.getProject());
    }
    @GetMapping("my")
    public Result<List<ApplyInformationVO>> getMyProjects(String responsiblePerson) {
        return projectService.getProjectByUsername(responsiblePerson);
    }
}
